package com.itheima.bridge;

public class BridgePattern {
    public static void main(String[] args) {
        Product productA = new ProductA() ;
        Color red = new Red() ;
        productA.setColor(red);
        productA.Operation();
    }
}


abstract class Product {
    private String name ;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    protected Color color ;

    public void setColor(Color color) {
        this.color = color;
    }

    public abstract void Operation() ;
}

class ProductA extends Product {
    @Override
    public void Operation() {
        color.OperationImg(this.getName());
    }
}

interface Color {
    void OperationImg(String name) ;
}

class Red implements Color {

    @Override
    public void OperationImg(String name) {
        System.out.println("Red...");
    }
}

class Blue implements Color {

    @Override
    public void OperationImg(String name) {
        System.out.println("Blue...");
    }
}
